package com.weishaoying.example.base.javaconfig;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author WeiShaoying
 * @date 2018/4/3
 */
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(JavaConfig.class);
        OrderService orderService = context.getBean(OrderService.class);
        orderService.sayHello();

        OrderService orderService1 = (OrderService) context.getBean("orderService");
        OrderService orderService2 = (OrderService) context.getBean("secondOrderService");
        String hello1 = orderService1.sayHello();
        String hello2 = orderService2.sayHello();
        System.out.println("--hello = " + hello1);
        System.out.println("--hello = " + hello2);
        context.close();
    }
}
